// placeFocus.js

// newFunction
function placeFocus() {
	if (document.forms.length > 0)
	 {
		var field = document.forms[0];
		for (i = 0; i < field.length; i++)
		{
			if ((field.elements[i].type == "text") || (field.elements[i].type == "password") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().charAt(0) == "s"))
			{
				document.forms[0].elements[i].focus();
				break;
         		}
      		}
   	}
}

<!-- DISABLE SPECIAL CHARACTER -->
<!-- Begin
//var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\|\!\;\:\'\"\,\.\?\/\\]/;
var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\|\!\;\:\'\"\/\\]/;
function dodacheck(val) {
	var strPass = val.value;
	var strLength = strPass.length;
	var lchar = val.value.charAt((strLength) - 1);
	if(lchar.search(mikExp) != -1) {
		var tst = val.value.substring(0, (strLength) - 1);
		val.value = tst;
   }
}
//  End -->

function onlyNumber(){
      if(event.keyCode <48 || event.keyCode >57 ){
              if(event.keyCode ==43){
                              return true;
              }
      return false;
      }
}

var th = ['','nghìn','tri&#7879;u', 't&#7927;','m&#7897;t nghìn tám'];

var dg = ['kh&#65533;ng','m&#7897;t','hai','ba','b&#7889;n', 'n&#259;m','sáu','b&#7843;y','tám','chín']; 
var tn = ['m&#432;&#7901;i','m&#432;&#7901;i m&#7897;t','m&#432;&#7901;i hai','m&#432;&#7901;i ba', 
'm&#432;&#7901;i b&#7889;n','m&#432;&#7901;i l&#259;m','m&#432;&#7901;i s&#65533;u', 
'm&#432;&#7901;i b&#7843;y','m&#432;&#7901;i t&#65533;m','m&#432;&#7901;i ch&#65533;n'];
var tw = ['hai m&#432;&#417;i','ba m&#432;&#417;i','b&#7889;n m&#432;&#417;i','n&#259;m m&#432;&#417;i', 
'sáu m&#432;&#417;i','b&#7843;y m&#432;&#417;i','tám m&#432;&#417;i','chí­n m&#432;&#417;i']; 
function toWords(s){
	s = s.toString();
	s = s.replace(/[\, ]/g,'');
	if (s.lenght < 0 || s != String(parseFloat(s)) || parseFloat(s) <= 0){
		return 'Số tiền không hợp lệ!';
	}
	var x = s.indexOf('.');
	if (x == -1) x = s.length;
	if (x > 15) return 'Số tiền không hợp lệ!';
	var n = s.split('');
	var str = '';
	var sk = 0; 
	for (var i=0; i < x; i++) {
		if ((x-i)%3==2) {
			if (n[i] == '1') {
				str += tn[Number(n[i+1])] + ' '; i++; sk=1;
			} else if (n[i]!=0) {
				str += tw[n[i]-2] + ' ';
				sk=1;
			}
		} else if (n[i]!=0) {
			str += dg[n[i]] +' '; 
			if ((x-i)%3==0) str += 'tr&#259;m ';sk=1;
		} if ((x-i)%3==1) {
			if (sk) str += th[(x-i-1)/3] + ' ';sk=0;
		}
	}
	if (x != s.length) {
		var y = s.length; str += 'point '; 
		for (var i=x+1; i<y; i++) str += dg[n[i]] +' ';
	} 
	str = str.replace(str.charAt(0),str.charAt(0).toUpperCase());
	return (str.replace(/\s+/g,' ')) + 'đồng';
}
